package com.zhengdongzulin.zuke.app.main.mine.waterAndElectricityMeter

import androidx.lifecycle.rxLifeScope
import com.lxj.androidktx.livedata.StateLiveData
import com.zhengdongzulin.zuke.app.Api
import com.zhengdongzulin.zuke.app.data.BillData
import com.zhengdongzulin.zuke.base.BaseViewModel
import rxhttp.wrapper.param.RxHttp
import rxhttp.wrapper.param.toResponse

class WAEMVm : BaseViewModel() {

    //var bill_list: StateLiveData<MutableList<BillData>> = StateLiveData()

    fun billElectricity(houseId: String ) {
        rxLifeScope.launch(
            {
                var r = RxHttp.postJson(Api.MINE_DIAN_BIAO)
                    .add("houseId", houseId)
                    .toResponse<MutableList<BillData>>()
                    .await()
                //bill_list.postValueAndSuccess(r)
            }, {
                //assignment(it, bill_list)
            }
        )
    }

    fun billWater(houseId: String ) {
        rxLifeScope.launch(
            {
                var r = RxHttp.postJson(Api.MINE_SHUI_BIAO)
                    .add("houseId", houseId)
                    .toResponse<MutableList<BillData>>()
                    .await()
                //bill_list.postValueAndSuccess(r)
            }, {
                //assignment(it, bill_list)
            }
        )
    }
}